package com.yunchang.springboot.mapper.mws.finances;

import com.yunchang.springboot.config.BaseDao;
import com.yunchang.springboot.models.DO.mws.finances.MwsFinancesFinancialReport;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MwsFinancesFinancialReportMapper extends BaseDao<MwsFinancesFinancialReport> {
    /**
     * 根据groupId获得这个账期的countryCode
     * */
    String getCountryCodeByGroupId(@Param("groupId")String groupId);

    String getLatestPostedDate();

    /**
     * 根据是否生成财务数据的状态及transactionTypeList查询出对应的数据
     * @param financeStatus
     * @param transactionTypeList
     * @return
     */
    List<com.yunchang.springboot.models.mwsfinance.MwsFinancesFinancialReport> selectByFinanceStatusAndTransactionTypeList(@Param("financeStatus") Integer financeStatus, @Param("transactionTypeList") List<String> transactionTypeList);

    /**
     * 根据是否生成财务数据的状态及transactionType查询出对应的数据
     * @param financeStatus
     * @param transactionType
     * @param limitValue
     * @param date
     * @return
     */
    List<com.yunchang.springboot.models.mwsfinance.MwsFinancesFinancialReport> selectByFinanceStatusAndTransactionType(@Param("financeStatus") Integer financeStatus, @Param("transactionType") String transactionType, @Param("limitValue")Integer limitValue, @Param("date")String date);

    /**
     * 根据是否生成财务数据的状态及transactionType查询出对应的数据的数量
     * @param financeStatus
     * @param transactionType
     * @param limitValue
     * @param date
     * @return
     */
    Long selectCountNumByFinanceStatusAndTransactionType(@Param("financeStatus") Integer financeStatus,@Param("transactionType") String transactionType,@Param("limitValue")Integer limitValue,@Param("date")String date);

    /**
     * 根据financialEventGroupId获取非空值marketplaceName
     * @param financialEventGroupId
     * @return
     */
    String selectMarketplaceNameByFinancialEventGroupId(String financialEventGroupId);

    /**
     * 根据mwsFinancesFinancialReportList对象集合批量更新
     * @param mwsFinancesFinancialReportList
     * @return
     */
    int updateMwsFinancesFinancialReportList(@Param("mwsFinancesFinancialReportList") List<com.yunchang.springboot.models.mwsfinance.MwsFinancesFinancialReport> mwsFinancesFinancialReportList);

    /**
     * 根据三个参数及quantityPurchased不为null查询QuantityPurchased
     * @param transactionType
     * @param amazonOrderId
     * @param postedDate
     * @return
     */
    Long selectQuantityPurchasedByTransactionTypeAndAmazonOrderIdAndPostedDateAndQuantityPurchasedIsNotNull(String transactionType,String amazonOrderId,String postedDate);

    /**
     * 根据参数获取sku
     * @param transactionType
     * @param amazonOrderId
     * @param postedDate
     * @return
     */
    List<String> selectSkuByTransactionTypeAndAmazonOrderIdAndPostedDateAndQuantity(String transactionType,String amazonOrderId,String postedDate);

}